package org.zxp.datastructure.link;

import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;

/**
 * @program: effectiveJava
 * @description:测试LinkedList的用法
 * @author: X-Pacific zhang
 * @create: 2019-07-09 11:29
 **/
public class LinkedListTest {
    public static void main(String[] args){
        LinkedList linkedList = new LinkedList();
        linkedList.addAll(Arrays.asList("1","2","3"));
        Iterator iterator = linkedList.listIterator(0);
        iterator.forEachRemaining(o -> System.out.println(o));

        System.out.println("================");

        ListIterator iterator2 = linkedList.listIterator(2);
        while(iterator2.hasPrevious()){
            System.out.println(iterator2.previous());
        }
    }
}
